home *** CD-ROM | disk | FTP | other *** search
- ///////////////////////////////////////////////////////////////////////////////
- // $Id: RAM.hxx,v 1.2 1995/01/13 00:31:06 bmott Exp $
- ///////////////////////////////////////////////////////////////////////////////
- // RAM.hxx
- //
- // The Random Access Memory Device
- //
- // Sim68000 "Motorola 68000 Simulator"
- // Copyright (c) 1993
- // By: Bradford W. Mott
- // July 26,1993
- //
- ///////////////////////////////////////////////////////////////////////////////
- // $Log: RAM.hxx,v $
- // Revision 1.2 1995/01/13 00:31:06 bmott
- // Remove the inline prefix from several member functions that shouldn't
- // have been inlined
- //
- // Revision 1.1 1994/02/18 20:12:36 bmott
- // Initial revision
- //
- ///////////////////////////////////////////////////////////////////////////////
-
- #ifndef RAM_HXX
- #define RAM_HXX
-
- #include <iostream.h>
- #include "String.h"
-
- #include "BasicDevice.hxx"
-
- class RAM : public BasicDevice {
- private:
- unsigned long base_address; // Starting address
- unsigned long size; // Size in bytes
-
- protected:
- unsigned char *buffer; // Buffer to hold the RAM's contents
-
- public:
- RAM(String args, BasicCPU* cpu);
-
- ~RAM();
-
- // See if the address maps into the device (1=Yes,0=No)
- char CheckMapped(unsigned long addr);
-
- // Return the lowest address used by the device
- virtual unsigned long LowestAddress()
- { return(base_address); }
-
- // Return the highest address used by the device
- virtual unsigned long HighestAddress()
- { return(base_address+size-1); }
-
- // Get a byte from the device
- virtual unsigned char Peek(unsigned long addr)
- { return (buffer[addr-base_address]); }
-
- // Put a byte into the device
- virtual void Poke(unsigned long addr, unsigned char c)
- { buffer[addr-base_address]=c; }
-
- // RAM never has Events
- void EventCallback(long, void*)
- {}
- };
-
- #endif
-